#include <stdio.h>
#include <algorithm>
using namespace std;

#define rep(i,n) for (int i=0; i<n; i++)

#define TRACE(x...)  
#define PRINT(x...) TRACE(printf(x))

int seq[110];
char c;
int unseq[110];
int prev;
int num;
int n;
int m;

int main() {
	n=0;
	while (scanf(" %d%c", &num, &c)!=EOF) {
		seq[n++]=num;	
	}

	prev=-1;
	m=0;

	sort(seq, seq+n);

	TRACE(
		rep(i,n) printf("%d ", seq[i]);
		printf("\n");
	)

	rep(i,n) {
		if (seq[i]==prev) continue;

		prev=seq[i];
		unseq[m++]=seq[i];
	}

	TRACE(
		rep(i,m) printf("%d ", unseq[i]);
		printf("\n");
	)

	int ind;

	rep(i,m) {
		ind=i;

		for (int j=i+1; j<m; j++) {
			if (unseq[j]-unseq[j-1]==1) {
				ind=j;
			}
			else break;
		}

		if (ind==i) {
			printf("%d", unseq[i]);
		}
		else {
			printf("%d-%d", unseq[i], unseq[ind]);
			i=ind;
		}

		if (i+1<m) printf(",");
	}	
	
	printf("\n");
	return 0;
}
